package com.jxwifi.cloud.quickclean.mycenter;

import android.content.Context;

import com.alibaba.fastjson.JSON;
import com.jxwifi.cloud.quickclean.app.AccountMgr;
import com.jxwifi.cloud.quickclean.app.UrlPool;
import com.jxwifi.cloud.quickclean.bean.InfoBean;
import com.jxwifi.cloud.quickclean.model.AuzImpl;
import com.jxwifi.cloud.quickclean.okhttp.Params;

public class SetNamePresenter {

    private Context mContext;
    private SetNameView mView;
    private AuzImpl mAuz;

    public SetNamePresenter(Context context,SetNameView view){
        this.mContext=context;
        this.mView=view;
        mAuz=new AuzImpl();
    }

    public void profileName(){
        Params params=new Params();
        params.add("nickname",mView.getSetName().getText().toString());
        mAuz.auzget(UrlPool.POST_UPDATE_PROFILE, params, new AuzImpl.AuzListener() {
            @Override
            public void AuzSuccess(int code, String data) {
                if (code==0){
                    mView.onSuccess(data);
                }else{
                    mView.onprofileName();
                }
            }

            @Override
            public void AuzFailure(int errorCode, String msg) {
                mView.onFailure(errorCode, msg);
            }
        });
    }
}
